import path from "path";
import { CleanWebpackPlugin } from "clean-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";

export default {
  entry: path.resolve("./src/third/test/run.ts"),
  target: "node",
  output: {
    path: path.resolve("./", "dist/third"),
    environment: {
      arrowFunction: false,
    },
  },
  resolve: {
    extensions: [".ts", ".js"], // Include TypeScript and JavaScript files
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: "ts-loader",
        exclude: /node_modules/,
      },
    ],
  },
  plugins: [
    new CleanWebpackPlugin(),
    new CopyPlugin({
      patterns: [
        {
          from: path.resolve("src/third/test/package.json"),
          to: path.resolve("dist/third/package.json"),
        },
      ],
    }),
  ],
};
